/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.OneCommerceProject.entities;

import java.io.Serializable;
import java.math.BigDecimal;
import javax.persistence.*;
import javax.resource.spi.AuthenticationMechanism;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Malek
 */
@Entity
@Table(name = "CATEGORY", catalog = "", schema = "AYMEN")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Category.findAll", query = "SELECT c FROM Category c"),
    @NamedQuery(name = "Category.findByIdCategory", query = "SELECT c FROM Category c WHERE c.idCategory = :idCategory"),
    @NamedQuery(name = "Category.findByCategorie", query = "SELECT c FROM Category c WHERE c.categorie = :categorie")})
public class Category implements Serializable {
    private static final long serialVersionUID = 1L;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "ID_CATEGORY", nullable = false, precision = 22)
    @GeneratedValue(strategy= GenerationType.AUTO)
    private BigDecimal idCategory;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 50)
    @Column(name = "CATEGORIE", nullable = false, length = 50)
    private String categorie;

    public Category() {
    }

    public Category(BigDecimal idCategory) {
        this.idCategory = idCategory;
    }

    public Category(BigDecimal idCategory, String categorie) {
        this.idCategory = idCategory;
        this.categorie = categorie;
    }

    public BigDecimal getIdCategory() {
        return idCategory;
    }

    public void setIdCategory(BigDecimal idCategory) {
        this.idCategory = idCategory;
    }

    public String getCategorie() {
        return categorie;
    }

    public void setCategorie(String categorie) {
        this.categorie = categorie;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idCategory != null ? idCategory.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Category)) {
            return false;
        }
        Category other = (Category) object;
        if ((this.idCategory == null && other.idCategory != null) || (this.idCategory != null && !this.idCategory.equals(other.idCategory))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return categorie;
    }
    
}
